import SysUserModel from "../../../model/system/SysUserModel";
import SysDeptModel from "../../../model/system/SysDeptModel";

SysUserModel.belongsToMany(SysDeptModel, {
  as: "dept", // 目标别名
  through: "sys_user_dept", // 关联表名称
  foreignKey: "userId", // 当前模型在关联表中的外键
  otherKey: "deptId", // 对方模型在关联表中的外键
  timestamps: false,
});

SysDeptModel.belongsToMany(SysUserModel, {
  as: "user",
  through: "sys_user_dept",
  foreignKey: "deptId",
  otherKey: "userId",
  timestamps: false,
});
